function BinToInt(B:string):Int64;
var i:byte; k:longint;
begin
result:=0;
k:=length(b);
for i:=1 to k do result:=(result shl 1)+(byte(B[i]) and 1);
end;